package SGEngine2

import (
	"github.com/gl"
)

type Scene struct {
	RootNode *Node
	Camera   Camera

	InitFunc func(scene *Scene)
}

func (s *Scene) Init() {
	gl.Viewport(0, 0, RootView.Width, RootView.Height)
	s.Camera.Init()
	if s.InitFunc != nil {
		s.InitFunc(s)
	}
}

func (s *Scene) Loop() {
	RenderCanvas.Clear()
	s.Camera.VisitNodes(s.RootNode, &Mat4Identity)
	RenderCanvas.Render()
}
